package com.itheima.reggie.config;
// MybatisPlus 的配置

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//@Configuration 1个或者多个@Bean方法，Spring容器可以使用这些方法来注入Bean
@Configuration
public class MybatisPlusConfig {

    // 这个方法就向Spring容器注入了一个类型是MybatisPlusInterceptor名字是mybatisPlusInterceptor的Bean
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        // 开启分页
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatisPlusInterceptor;
    }
}
